.post
  .box
    %h2= "#{@document.title}(#{@status})"
  .body
    = @document.body.html_safe
  .box
    - if can? :conferences_moderator   #TODO автоматически определять роль по имени контроллера
      = link_to t('edit'), edit_documents_conference_path(@conference), :class => "btn"
    = link_to t('back'), :back, :class => "btn"
  .box.light-gray
    = render :partial => 'shared/document_info', :locals => {:document => @document }
  = render :partial => 'shared/comments', :locals => {:comments => @comments, :document => @document}

- content_for :sidebar do
  %ul
    %li.info.box.light-gray
      %h2= t('information')
      %dl
        %dt= t('status')
        %dd= @status
        .separator
        %dt= t('conferences.info.organizer')
        %dd= link_to @document.user.full_name, "#"
        .separator
        %dt= t('conferences.info.members_count')
        %dd= @members_count
        .separator
        %dt= t('conferences.info.start_date')
        %dd= l @conference.start_date
        .separator
        %dt= t('conferences.info.end_date')
        %dd= l @conference.end_date
        .clearfix

    %li.reports.box.light-gray
      %h2= t('reports')
      - if @reports.present?
        %ul
          - @reports.each do |report|
            %li= link_to report.document.title, documents_conference_report_path(@conference, report)
            .separator
      - else
        %p= t 'no_data'
        .separator
      - if @conference.opened?
        .content-center= link_to t('add'), new_documents_conference_report_path(@conference), :class => "btn primary"
      - else
        %p.content-left= t('errors.report.conference_not_opened')

    %li.members.box.light-gray
      %h2= "#{t 'members'} (#{@members_count})"
      %dl#members-list
        - @members.each do |member|
          %dt.member
            = image_tag member.avatar.url(:thumb), :alt => ""
          %dd
            = link_to member.full_name, "#"
            - member_reports_count = @reports.search('document_user_id_eq' => member.id).count
            = link_to "reports(#{member_reports_count})", "#"
          .separator
      - if @members.count < @members_count
        .actions
          = hidden_field_tag 'members_current_page', 1
          = hidden_field_tag 'members_count', @members_count
          = button_tag t('conferences.show_more_members'), 'data-url' => members_documents_conference_path(@conference),
            :id => "more_members", :class => "show-loader btn small"
          = button_tag t('conferences.show_remaining_members'), 'data-url' => members_documents_conference_path(@conference),
            :id => "all_members", :class => "show-loader btn small"
          = ajax_loader

= render 'templates/member'